from apiTest.serializers import TestCaseGroupResultModelSerializer
from common.common_base_model_serializer import BaseModelSerializer, NestedJSONField
from task.models import TaskInfo, TaskLog


class TaskInfoModelSerializer(BaseModelSerializer):
    email_list = NestedJSONField()

    class Meta:
        model = TaskInfo
        fields = '__all__'


class TaskLogModelSerializer(BaseModelSerializer):
    class Meta:
        model = TaskLog
        fields = '__all__'


class TaskLogDetailsSerializer(BaseModelSerializer):
    group_result_list = TestCaseGroupResultModelSerializer(many=True, required=False)

    class Meta:
        model = TaskLog
        fields = '__all__'
